home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '93 / Papers '93 / Macintosh as Internet Server ƒ / inetd / UDP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-06  |  1.2 KB  |  74 lines  |  [TEXT/MPS ]

  1.  
  2. #ifndef __MYUTILS__
  3. #include <myUtils.h>
  4. #endif
  5.  
  6. #ifndef __CLIST__
  7. #include <CList.h>
  8. #endif
  9.  
  10. #ifndef __MACTCPCOMMONTYPES__
  11. #include <MacTCPCommonTypes.h>
  12. #endif
  13. #ifndef __UDPPB__
  14. #include <UDPPB.h>
  15. #endif
  16.  
  17. class InetD;
  18. class UDPListener;
  19.  
  20. class PortItem : public CItem {
  21. public:
  22.     udp_port    fPort;
  23.  
  24.     StreamPtr    fStream;
  25.     ProcPtr        fProc;
  26.     Ptr            fUsrPtr;
  27.     PSN            fPSN;
  28.     
  29.     InetD*        fDaemon;
  30.  
  31.                 PortItem();
  32. };
  33.  
  34. class UPortList : public CList {
  35. public:
  36.     PortItem*    GetItem(StreamPtr stream);
  37.     PortItem*    GetItem(PSNPtr psn);
  38. };
  39.  
  40. class UDPListener {
  41. public:
  42.     UPortList    fNoteeList;
  43.     
  44.     UPortList    fWaitList;        // waiting for data
  45.     UPortList    fLaunchList;    // waiting for handler to launch
  46.     UPortList    fRestartList;    // waiting for handler to quit
  47.     
  48.     InetD*        fDaemon;
  49.     
  50.                 UDPListener(InetD* daemon);
  51.                 ~UDPListener();
  52.                 
  53.     Boolean        Initialize();
  54.     
  55.     void        DoNull();
  56.     
  57.     void        NotifyMe(PSNPtr psn, StreamPtr stream, ProcPtr proc, Ptr usr);
  58.     void        UnNotify(PSNPtr psn);
  59.  
  60.     void        ListenAgain(PSNPtr psn);
  61.  
  62.     void        Release();
  63.     void        CloseDown(StreamPtr stream);
  64.     void        ListenOn(udp_port port);
  65. };
  66.  
  67. extern "C" {
  68.     pascal void    UDPNotify(    StreamPtr stream,
  69.                             unsigned short eventCode,
  70.                             Ptr    usrData,
  71.                             struct ICMPReport* icmp);
  72. };
  73.  
  74.